package com.ruoyi.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mapper.GoodsPurchaseMapper;
import com.ruoyi.domain.GoodsPurchase;
import com.ruoyi.service.IGoodsPurchaseService;

/**
 * 采购订单Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-05-13
 */
@Service
public class GoodsPurchaseServiceImpl implements IGoodsPurchaseService 
{
    @Autowired
    private GoodsPurchaseMapper goodsPurchaseMapper;

    /**
     * 查询采购订单
     * 
     * @param purchaseId 采购订单主键
     * @return 采购订单
     */
    @Override
    public GoodsPurchase selectGoodsPurchaseByPurchaseId(Long purchaseId)
    {
        return goodsPurchaseMapper.selectGoodsPurchaseByPurchaseId(purchaseId);
    }

    /**
     * 查询采购订单列表
     * 
     * @param goodsPurchase 采购订单
     * @return 采购订单
     */
    @Override
    public List<GoodsPurchase> selectGoodsPurchaseList(GoodsPurchase goodsPurchase)
    {
        return goodsPurchaseMapper.selectGoodsPurchaseList(goodsPurchase);
    }

    /**
     * 新增采购订单
     * 
     * @param goodsPurchase 采购订单
     * @return 结果
     */
    @Override
    public int insertGoodsPurchase(GoodsPurchase goodsPurchase)
    {
        return goodsPurchaseMapper.insertGoodsPurchase(goodsPurchase);
    }

    /**
     * 修改采购订单
     * 
     * @param goodsPurchase 采购订单
     * @return 结果
     */
    @Override
    public int updateGoodsPurchase(GoodsPurchase goodsPurchase)
    {
        return goodsPurchaseMapper.updateGoodsPurchase(goodsPurchase);
    }

    /**
     * 批量删除采购订单
     * 
     * @param purchaseIds 需要删除的采购订单主键
     * @return 结果
     */
    @Override
    public int deleteGoodsPurchaseByPurchaseIds(Long[] purchaseIds)
    {
        return goodsPurchaseMapper.deleteGoodsPurchaseByPurchaseIds(purchaseIds);
    }

    @Override
    public List<GoodsPurchase> selectGoodsPurchase() {
        return goodsPurchaseMapper.selectGoodsPurchase();
    }

    @Override
    public int checkSn(String purchaseSn) {
        return goodsPurchaseMapper.selectCountByPurchaseSn(purchaseSn);
    }

    /**
     * 删除采购订单信息
     * 
     * @param purchaseId 采购订单主键
     * @return 结果
     */
    @Override
    public int deleteGoodsPurchaseByPurchaseId(Long purchaseId)
    {
        return goodsPurchaseMapper.deleteGoodsPurchaseByPurchaseId(purchaseId);
    }
}
